#include <iostream>
#include <map>
using namespace std;

typedef unsigned long long int uint;
typedef map <uint, uint> Map;
typedef Map::iterator It;

const uint UNO = 1;


uint digits_of (uint n)
{
	uint d, pot;
	for (d = 0, pot = 1; pot <= n; ++d, pot <<= 1);
	return d;
}


uint power (uint a, uint e)
{
	uint r = 1;
	while (e)
	{
		if (e % 2 == 1)
			r *= a;
		a *= a;
		e /= 2;
	}
	return r;
}


Map m;


uint ones_until_2power (uint d)
{
	uint n = (UNO << d) - 1;
	It it = m.find (n);
	if (it != m.end())
		return it->second;

	uint r;
	r = d * (UNO << (d - 1));
	m[n] = r;
	return r;
}


uint ones_until (uint n)
{
	It it = m.find (n);
	if (it != m.end())
		return it->second;

	uint d, pot, r, next;

	d = digits_of (n);
	pot = UNO << (d - 1);
	r = ones_until_2power (d - 1);
	next = n - pot;
	r += next + ones_until (next) + 1;
	m[n] = r;
	return r;
}


int main ()
{
	uint a, b, r;
	m[0] = 0;
	m[1] = 1;
	while (cin >> a >> b, !cin.fail())
	{
		r = ones_until (b) - ones_until (a - 1);
		cout << r << endl;
	}
	return 0;
}